<?php
namespace app\index\controller;
use app\index\model\Link;
use app\index\model\Logis;
use think\Controller;
use think\view;

class Index extends Controller
{
    public function index()
    {

        $link_id = input('id');
        $link_obj = new Link();

        if (empty($link_id) || !isset($link_id)) {
            $link_info = $link_obj->getLinkData()->toArray()[0];
            $link_id =  $link_info['link_id'];
        } else {
            $link_info = $link_obj->getLinkUser($link_id);
        }      

        // var_dump($link,$link_id);
        $this->assign('link_info',$link_info);
        $this->assign('link_id',$link_id);
        return $this->fetch();

    }

    public function login(){

    }

    public function download(){

        if(\request()->isAjax() || \request()->isPost()){
            $ifs = input('ifs');
            $id = input('id');
            $logis_obj = new Logis();
            $logis_obj->addLogs($ifs,$id);
            return json(array('code' => 0));
        }

        return json(array('code' => 1));
        
    }
}
